# @Author: twisly
# @Date:   2021-04-12 15:51:09
# @Last Modified by:   twisly
# @Last Modified time: 2021-04-12 15:52:43

upstream_ip=$1

ngx_upstream_file=$2

line_num=`sed -n "/${1}/=" ${ngx_upstream_file}`

line_data=`sed -n "${line_num}p" ${ngx_upstream_file}`

if [[ ${line_data} == *#* ]]; then

	line_data=`echo ${line_data#*#}`

	sed "${line_num}c ${line_data}" ${ngx_upstream_file} > tmp_result

	cat tmp_result > ${ngx_upstream_file}
fi